package com.haiqi.modules.map.service;

import com.haiqi.common.persistence.dao.AisShipMapper;
import com.haiqi.common.persistence.dao.MobileShipMapper;
import com.haiqi.common.persistence.entity.AisShip;
import com.haiqi.common.persistence.entity.MobileShip;
import com.haiqi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by hythzx on 2016/7/7.
 */
@Service
public class MobileShipService {

    @Autowired
    private MobileShipMapper mobileShipMapper;

    @Autowired
    private AisShipMapper aisShipMapper;

    public List<MobileShip> getDataList(MobileShip mobileShip){
        List<MobileShip> dataList = mobileShipMapper.getDataList(mobileShip);
        return dataList;
    }

    public List<AisShip> aisShipList(AisShip aisShip){
        List<AisShip> shipList = aisShipMapper.getShipList(aisShip);
        if(shipList != null){
            for (AisShip ship : shipList) {
                Date postime = ship.getPostime();
                String s = DateUtils.formatDateTime(postime);
                ship.setPostTimeDesc(s);
            }
        }
        return shipList;
    }
}
